﻿using HardcoreGame.Common.Players;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace HardcoreGame.Content.Buffs
{
    public class Corrosion : ModBuff
    {
        public override void SetStaticDefaults()
        {
            Main.debuff[Type] = true;
            Main.buffNoTimeDisplay[Type] = true;
        }
        public override void Update(Player player, ref int buffIndex)
        {
            player.lifeRegen -= 5;
            player.statDefense -= 10;
            player.endurance -= 0.1f;
            ModContent.GetInstance<EventPlayer>().acidRain = true;
            if (Main.rand.NextBool(4))
            {
                int num = Dust.NewDust(player.position, player.width, player.height, DustID.TerraBlade, 0f, 0f, 0, default, 1f);
                Main.dust[num].scale *= 0.4f;
                Main.dust[num].velocity *= 0f;
            }
        }
        public override void Update(NPC npc, ref int buffIndex)
        {
            npc.lifeRegen -= 5;
            if (Main.rand.NextBool(4))
            {
                int num = Dust.NewDust(npc.position, npc.width, npc.height, DustID.TerraBlade, 0f, 0f, 0, default, 1f);
                Main.dust[num].scale *= 0.4f;
                Main.dust[num].velocity *= 0f;
            }
        }
    }
}
